// Package updating_content_in_gui
// desc: x
// author: Locker
// date: 2024/6/8
// version: 1.0.0
package main

import (
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/widget"
	"time"
)

func main() {
	a := app.New()
	w := a.NewWindow("updating_content_in_gui")

	labelClock := widget.NewLabel("")
	updateTime(labelClock)

	w.SetContent(labelClock)
	go func() {
		for range time.Tick(time.Second) {
			updateTime(labelClock)
		}
	}()

	w.ShowAndRun()
}

func updateTime(label *widget.Label) {
	format := time.Now().Format("Time: 03:04:05")
	label.SetText(format)
}
